﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace FAQ_UI
{
	public class ImageErrDrawable : Drawable
	{
		private Typeface mTypeface;
		private Typeface mIconTypeface;
		public ImageErrDrawable()
		{
			mTypeface = new Typeface("Arial");
			mIconTypeface = FAQUtil.getIconFont();
		}

		public override void draw(DrawingContext dc)
		{
			Brush color = Theme.TextMainBrush;
			double size = bounds.Height / 2;
			FormattedText t = new FormattedText("\ue3ad", CultureInfo.InvariantCulture, FlowDirection.LeftToRight, mIconTypeface, size, color, 96);
			dc.DrawText(t, new Point(bounds.X + bounds.Width / 2 - size / 2, bounds.Y + bounds.Height / 2 - size / 2));
			double size2 = bounds.Height / 7;
			t = new FormattedText("图像错误", CultureInfo.InvariantCulture, FlowDirection.LeftToRight, mTypeface, size2, color, 96);
			double ww=t.WidthIncludingTrailingWhitespace;
			double lh=t.LineHeight;
			dc.DrawText(t, new Point(bounds.X + bounds.Width / 2 - ww / 2, bounds.Y + bounds.Height / 2 +size/2+lh));
		}
		public override double getIntrinsicWidth()
		{
			return 100;
		}
		public override double getIntrinsicHeight()
		{
			return 100;
		}
	}
}
